﻿using DevExpress.XtraReports.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using JXC.Core;
using JXC.UI;
using JXC.WebApi.EntityExtend;
using SqlSugar;

namespace JXC.ReportPrint
{
    public partial class frmCGRKTJBPrint : DevExpress.XtraReports.UI.XtraReport
    {
        public List<CGTJB> data = null;
        private APIClient client = new APIClient();
        public frmCGRKTJBPrint()
        {
            InitializeComponent();
           
        }

        public frmCGRKTJBPrint(List<CGTJB> d):this()
        {
            data = d;
            BindData();
        }
        private void BindData()
        {
            DataSet ds = new DataSet();
            var table = data.ListToDataTable();
            ds.Tables.Add(table);
            this.DataSource = ds;
            this.xrTableCell9.DataBindings.Add("Text", ds, "code");
            this.xrTableCell10.DataBindings.Add("Text", ds, "CodeTime");
            this.xrTableCell11.DataBindings.Add("Text", ds, "GHSName");
            this.xrTableCell12.DataBindings.Add("Text", ds, "SPCode");
            this.xrTableCell13.DataBindings.Add("Text", ds, "SPName");
            this.xrTableCell14.DataBindings.Add("Text", ds, "DJ");
            this.xrTableCell15.DataBindings.Add("Text", ds, "SL");
            this.xrTableCell16.DataBindings.Add("Text", ds, "ZJE");
            xrLabel9.Text = DateTime.Now.ToString();
            xrLabel3.Text=data.Sum(p=>p.ZJE).ToString();
        }
    }
}
